package com.usian.admin.controller;

import com.usian.admin.service.UserLoginService;
import com.usian.admin.service.WemediaNewsAutoScanService;
import com.usian.api.admin.LoginControllerApi;
import com.usian.model.admin.dtos.AdUserDto;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/login")
public class LoginController implements LoginControllerApi {

    @Autowired
    private UserLoginService userLoginService ;

    @Autowired
    private WemediaNewsAutoScanService scanService;

    @Override
    @PostMapping("/in")
    public ResponseResult login(@RequestBody AdUserDto dto){
        return userLoginService.login(dto);
    }
//    @PostMapping("out")
//    public ResponseResult logOut (@RequestParam String name){
//        return ResponseResult .okResult(name);
//    }

    @GetMapping("out")
    public  ResponseResult logOut(@RequestParam String name){
        return ResponseResult.okResult(name);
    }

    @GetMapping("auto")
    public ResponseResult auto(Integer id){
      return   scanService.autoScanByMediaNewsId(id);
    }
}
